package April._22.work2;



import java.io.FileWriter;
import java.io.IOException;
import java.util.Random;

public class Main {
    public static void main(String[] args) {
        //生成密码
        Random random = new Random();
        StringBuffer password = new StringBuffer();
        for (int i = 0; i < 3; i++) {
            int digit=random.nextInt(10);
            password.append(digit);
        }
        System.out.println("password = " + password);
        String s = new String(password);

        //传入文件路径
        FileWriter out=null;
        try {
            out = new FileWriter("fileTest\\b.txt");
        } catch (IOException e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }
        GuessPassword guessPassword = new GuessPassword(s,out);
        Thread t1 = new Thread(guessPassword,"A");
        t1.start();
    }
}
